<template>
	<view class="al">
		
	<form @submit="formSubmit" @reset="formReset">
		<view class="for">
		<view class="content">
			<label class="lable">*电炉铁水标准碳含量%:</label>
			<!-- <input class="txt" type="text" v-model="form.tsCbz" placeholder="请输入.." /> -->
			<text    class="v_input"   >{{form.tsCbz}}</text>
		</view> 
		
		<!-- <view class="content">
			<label class="lable">低碳废钢碳含量%:</label>
			<input class="txt"   type="text" v-model="form.fgCbz" placeholder="请输入.." />
		</view> -->
		
			<view class="content">
				<label class="lable">电炉铁水量kg:</label>
				<input  class="v_input"  type="text" v-model="dlts" placeholder="请输入.." />
			</view>
			
			<view class="content">
				<label class="lable">电炉铁水实测碳含量%:</label>
				<input  class="v_input"  type="text" v-model="sc"  placeholder="请输入.." />
			</view>
			<view class="blac"></view>
			<view class="content">
				<label class="lable">电炉铁水倒出量kg:</label>
				<label class="txtr"  >{{tssub}}</label>
			</view>
			<view class="content">
				<label class="lable">废钢加入量:</label>
				<label class="txtr"  >{{fgadd}}</label>
			</view>
		</view>
		
		
		<button form-type="submit" class="btn">计算</button>
	</form>
		
	</view>
</template>

<script>
	import configService from '@/common/config.service.js';
	const apiUrl = configService.apiUrl;
	export default {
		data() {
			return {
				dlts:'',
				sc:'',
				tssub:'0',
				fgadd:'0',
				form: null
			}
		},
		mounted() {
			this.getdata();
		},
		onShow:function(e){
			this.$verify.verify();
		},
		methods: {
			getdata() {
				uni.request({
						url: apiUrl+'/jtss/list',
						header: {
							'content-type': 'application/json' //自定义请求头信息
						},
						method : 'POST',
						data:{
							type : 1,
							 deptId : uni.getStorageSync("deptId")
						},
						success: (res) => {
							if(res.statusCode === 200 && res.data.data.length > 0 ){
								this.form = res.data.data[0];
								console.log(this.form)
							}else{
								uni.showModal({
									title: '提示',  //提示标题
									content: '请维护电炉成分调整标准！',  //提示内容
									showCancel: true, //是否显示取消按钮
									success: function (res) {
										if (res.confirm) {  //confirm为ture，代表用户点击确定
											console.log('点击了确定按钮');
										} else if (res.cancel) {  //cancel为ture，代表用户点击取消
											console.log('点击了取消按钮');
										}
									}
								})		
							}
							// console.log(res);
							// if (res.statusCode === 200) {
							// 	self.Info = res.data;
							// }
							// console.log(res);
							// this.form = res.data.data[0];
							// if(res.statusCode === 200)
							// {
							// 	self.Info = res.data;
							// 	//返回数据
							// }
						},
				});
				
			},
			
		    opera(val) {
		      console.log(val, "111111");
		      this.tssub = (this.dlts*(this.sc-val.tsCbz)/(this.sc-val.fgCbz)).toFixed(2);
				this.fgadd = (this.dlts*(this.sc-val.tsCbz)/(this.sc-val.fgCbz)).toFixed(2);
		    },
		    formSubmit(e) { 
		      if(this.form == null ){
					uni.showToast({
						 title: "请先维护包内合金成分速算标准！",
						 icon:'error',
						 duration:1000
					})
				}
				this.opera(this.form);
		    },
		}
	}
</script>

<style>
	@import url("@/common/comcss.css");
</style>
